package com.example.note;





import android.app.ActionBar;
import android.app.Activity;
import android.content.ClipData.Item;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.TextView.OnEditorActionListener;

public class Insert_note extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_insert_note);
		
		ActionBar actionBar = getActionBar();

		// add the custom view to the action bar
		actionBar.setCustomView(R.layout.actionbar_view);
		EditText search = (EditText) actionBar.getCustomView().findViewById(
				R.id.searchfield);
		search.setOnEditorActionListener(new OnEditorActionListener() {

			@Override
			public boolean onEditorAction(TextView v, int actionId,
					KeyEvent event) {
				Toast.makeText(Insert_note.this, "Search triggered",
						Toast.LENGTH_LONG).show();
				return false;
			}
		});
		
		
		
		
		
		
		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
				| ActionBar.DISPLAY_SHOW_CUSTOM);

		actionBar.setDisplayHomeAsUpEnabled(true);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.insert_note, menu);
		
		
		return true;
	}
	
	//định nghĩa các hàm insert và refresh
	public void them(View v)
	{
		ActionBar actionBar = getActionBar();
		EditText search = (EditText) actionBar.getCustomView().findViewById(
				R.id.searchfield);
		EditText txtcontent=(EditText) findViewById(R.id.txtcontent);
	}
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		switch (item.getItemId()) {
		case R.id.btnsave:
			//makeToast("Menu Save");
			break;
		

		case R.id.btnrefresh:
			//makeToast("Menu Help");
			break;

		}
		
		return super.onOptionsItemSelected(item);
	}
}
